/*
 * @Author: c
 * @Date: 2023-12-26 12:09:58
 * @LastEditTime: 2024-01-17 04:01:20
 * @LastEditors: c
 * @Description: 
 * @FilePath: \music-web-backend\src\core\system\dict_type\dict_type.controller.ts
 * https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
import { Body, Controller, Delete, Get, Param, ParseIntPipe, Post, Put, Query } from '@nestjs/common';
import { DictTypeService } from './dict_type.service';
import { DictTypeForm } from './dto/create-dict_type.dto';
import { DictTypePageQuery } from './dto/search-dict_type.dto';

@Controller('dict_type')
export class DictTypeController {
  constructor(private readonly dictTypeService: DictTypeService) { }




  //字典-所有类型-分页列表
  @Get("page")
  public getDictPage(
    @Query() queryParams: DictTypePageQuery
  ) {
    return this.dictTypeService.getDictTypePage(queryParams);

  }

  /**
 * 字典-所有类型-新增
 * @param createDictDto 
 * @returns 
 */
  @Post('')
  create(@Body() createDictDto: DictTypeForm) {
    return this.dictTypeService.create(createDictDto);
  }

  @Get()
  findAll() {
    return this.dictTypeService.findAll();
  }

  /**
   * 字典-所有类型-查询单条数据
   * @param id 
   * @returns 
   */
  @Get(':id/form')
  findOne(@Param('id', ParseIntPipe) id: number) {
    return this.dictTypeService.findOne(id);
  }


  

  /**
   * 字典-所有类型-修改单条数据
   * @param id 
   * @param updateDictTypeDto 
   * @returns 
   */
  @Put(':id')
  update(@Param('id',ParseIntPipe) id: number, @Body() updateDictTypeDto: DictTypeForm) {
    return this.dictTypeService.update(id, updateDictTypeDto);
  }

  /**
   * 字典-所有类型-根据ID删除单条数据
   * @param id 
   * @returns 
   */
  @Delete(':ids')
  remove(@Param('ids') ids: string) {
    return this.dictTypeService.removeByIds(ids);
  }
}
